home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat3
/
Tcl
/
appinit.z
/
appinit
Wrap
Text File
|
1998-10-30
|
5KB
|
133 lines
TTTTccccllll____AAAAppppppppIIIInnnniiiitttt((((3333TTTTccccllll)))) TTTTccccllll____AAAAppppppppIIIInnnniiiitttt((((3333TTTTccccllll))))
NNNNAAAAMMMMEEEE
Tcl_AppInit - perform application-specific initialization
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
int
TTTTccccllll____AAAAppppppppIIIInnnniiiitttt(_i_n_t_e_r_p)
AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
Tcl_Interp *_i_n_t_e_r_p (in) Interpreter for the application.
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
TTTTccccllll____AAAAppppppppIIIInnnniiiitttt is a ``hook'' procedure that is invoked by the main programs
for Tcl applications such as ttttccccllllsssshhhh and wwwwiiiisssshhhh. Its purpose is to allow new
Tcl applications to be created without modifying the main programs
provided as part of Tcl and Tk. To create a new application you write a
new version of TTTTccccllll____AAAAppppppppIIIInnnniiiitttt to replace the default version provided by
Tcl, then link your new TTTTccccllll____AAAAppppppppIIIInnnniiiitttt with the Tcl library.
TTTTccccllll____AAAAppppppppIIIInnnniiiitttt is invoked after by TTTTccccllll____MMMMaaaaiiiinnnn and TTTTkkkk____MMMMaaaaiiiinnnn after their own
initialization and before entering the main loop to process commands.
Here are some examples of things that TTTTccccllll____AAAAppppppppIIIInnnniiiitttt might do:
[1] Call initialization procedures for various packages used by the
application. Each initialization procedure adds new commands to
_i_n_t_e_r_p for its package and performs other package-specific
initialization.
[2] Process command-line arguments, which can be accessed from the Tcl
variables aaaarrrrggggvvvv and aaaarrrrggggvvvv0000 in _i_n_t_e_r_p.
[3] Invoke a startup script to initialize the application.
TTTTccccllll____AAAAppppppppIIIInnnniiiitttt returns TCL_OK or TCL_ERROR. If it returns TCL_ERROR then it|
must leave an error message in _i_n_t_e_r_p->_r_e_s_u_l_t; otherwise the result is |
ignored. |
In addition to TTTTccccllll____AAAAppppppppIIIInnnniiiitttt, your application should also contain a |
procedure mmmmaaaaiiiinnnn that calls TTTTccccllll____MMMMaaaaiiiinnnn as follows: |
Tcl_Main(argc, argv, Tcl_AppInit); |
The third argument to TTTTccccllll____MMMMaaaaiiiinnnn gives the address of the application- |
specific initialization procedure to invoke. This means that you don't |
have to use the name TTTTccccllll____AAAAppppppppIIIInnnniiiitttt for the procedure, but in practice the |
name is nearly always TTTTccccllll____AAAAppppppppIIIInnnniiiitttt (in versions before Tcl 7.4 the name |
TTTTccccllll____AAAAppppppppIIIInnnniiiitttt was implicit; there was no way to specify the procedure |
explicitly). The best way to get started is to make a copy of the file |
ttttccccllllAAAAppppppppIIIInnnniiiitttt....cccc from the Tcl library or source directory. It already |
contains a mmmmaaaaiiiinnnn procedure and a template for TTTTccccllll____AAAAppppppppIIIInnnniiiitttt that you can |
PPPPaaaaggggeeee 1111
TTTTccccllll____AAAAppppppppIIIInnnniiiitttt((((3333TTTTccccllll)))) TTTTccccllll____AAAAppppppppIIIInnnniiiitttt((((3333TTTTccccllll))))
modify for your application.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
application, argument, command, initialization, interpreter
PPPPaaaaggggeeee 2222